var _Step = require('scenes/game/toturial/step.js');
var _inherit = require('core/inherit.js');
var _global = require('global/global.js');

var _layout = require('tools/layout.js');
var _relative = _layout.relative;
var R = require('res/texture.js').R;

function Step() {
    _Step.call(this);
    this.mMoveCount = 0;
}
_inherit(Step, _Step);
Step.prototype.onMergeFinish = function () {
    if (this.hasSlot(3)) {
        this.mLocal.find('gamearea').removeView(this.mView);
        this.mToturial.nextStep();

        this.mLocal = null;
        this.mToturial = null;
        this.mView = null;
    }
};
Step.prototype.onStart = function (toturial, local) {
    this.mToturial = toturial;
    this.mLocal = local;

    this.mView = _global.ninePatchNode(R.ui.guide, 'all', 20, 20, 20, 20);
    this.mView.setSize(402, 412);
    this.mView.setAnchor(0.5, 0.5);

    var gamearea = local.find('gamearea');
    gamearea.addView(this.mView);
    _relative.local.layoutTo(this.mView, 0.5, 0.5, gamearea, 0.5, 0.5);

    var rtf = this.rtfHeader().textBuilder()
        .addText('Use the walls to add\n ', 'black')
        .addText('1', 'green')
        .addText(' & ', 'black')
        .addText('2', 'red')
        .addText(' together', 'black')
        .create();
    toturial.showHeaderTip(rtf);
};

module.exports = Step;